package com.zx.flow.api.listener.request;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zx.flow.api.dict.FlowDict.Status;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Date;
import lombok.Data;

/**
 * 流程上下文
 */
@Data
@Schema(title = "流程上下文", description = "流程上下文[用于与客户端监听器传输数据，确保数据量不会太大]")
public class FlowContext4Listener {

    @Schema(description = "流程ID, uuid", example = "7cf79580-07c9-4bf1-b061-51561a6748ee")
    private String id;

    @Schema(description = "流程标题", example = "【张三】关于XXX申请")
    private String title;

    @Schema(description = "流程配置id", example = "d65f0f578cd67f0363d92431f420ff02")
    private String flowConfigId;

    @Schema(description = "流程配置code", example = "my_apply")
    private String flowConfigCode;

    /**
     * 流程状态
     * {@link Status}
     */
    @Schema(description = "流程状态")
    private String status;

    @Schema(description = "开始时间", example = "2023-12-04 14:06:59")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date startDateTime;

    @Schema(description = "结束时间", example = "2023-12-04 14:06:59")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date endDateTime;

    @Schema(description = "自定义流程上下文数据,支持json,map,对象等", example = "{\"type\":1, \"account\":\"zhangsan\"}")
    private String extendData;

    @Schema(description = "申请原因", example = "需要XXXXX")
    private String applyReason;

    @Schema(description = "申请人账号", example = "zhangsan")
    private String applyAccountCode;

    @Schema(description = "创建时间", example = "2023-12-04 14:06:59")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Schema(description = "更新时间", example = "2023-12-04 14:06:59")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Schema(description = "当前节点code", example = "node2")
    private String currentNodeCode;

    /**
     * 父流程ID
     */
    @Schema(description = "父流程ID", example = "7cf79580-07c9-4bf1-b061-51561a6748ee")
    private String parentFlowId;

    @Schema(description = "父流程节点ID", example = "187715d8-cf83-18c6-13a1-222fd6b750va")
    private String parentNodeId;

}
